package com.thinkingstar.iads.datacenter.controller;

import javax.servlet.http.HttpServletRequest;

import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.By;
import org.nutz.mvc.annotation.Filters;
import org.nutz.mvc.annotation.Ok;

import com.thinkingstar.iads.common.filter.GlobalsFilter;
import com.thinkingstar.iads.common.filter.UserLoginFilter;
import com.thinkingstar.iads.datacenter.serviceImpl.EquipmentServiceImpl;

@IocBean
@At("/dataCenter/equipment")
@Filters({ @By(type = GlobalsFilter.class) , @By(type = UserLoginFilter.class)})
public class EquipmentBasicDataController {
	
	private static Log log = Logs.get();
	
	@Inject
	private EquipmentServiceImpl equipmentServiceImpl;
	
	//查看设备详情
	@At("/findEquipmentInfoById/?")
	@Ok("beetl:/projectRoot/dcCenter/historyDataBase/equipment/equipmentInfoTab.html")
	public NutMap findEquipmentInfoById(String equipment_id){
		return new NutMap("equipment_id",equipment_id);
	}
	
	
	//查询设备基础资料
	@At("/findEquipmentBasic/?")
	@Ok("json:full")
	public NutMap findEquipmentBasic(String equipment_id){
		String data = equipmentServiceImpl.getEquipmentBasicById(equipment_id);
		return new NutMap("data", data);
	}
	
	//设备厂商信息
	@At("/findEquipmentCsxx/?")
	@Ok("json:full")
	public NutMap findEquipmentCsxx(String equipment_id){
		String data = equipmentServiceImpl.getEquipmentCsxxById(equipment_id);
		return new NutMap("data",data);
	}
	
	//查询设备照片
	@At("/findEquipmentPhoto/?")
	@Ok("json:full")
	public NutMap findEquipmentPhoto(String equipment_id){
		String url = equipmentServiceImpl.getEquipmentPhotoById(equipment_id);
		return new NutMap("data", url);
	}
	
	//查询设备土建条件图
	@At("/findEquipmentTjtjt/?")
	@Ok("json:full")
	public String findEquipmentTjtjt(String equipment_id , HttpServletRequest request){
		String html = equipmentServiceImpl.getTjtjtHtmlById(equipment_id,request);
		return html;
	}
	
	
	//查询设备用户需求书
	@At("/findEquipmentYhxqs/?")
	@Ok("json:full")
	public NutMap findEquipmentYhxqs(String equipment_id){
		String url = equipmentServiceImpl.getEquipmentYhxqsById(equipment_id);
		return new NutMap("data",url);
	}
	
	//查询设备技术接口
	@At("/findEquipmentJsjk/?")
	@Ok("json:full")
	public NutMap findEquipmentJsjk(String equipment_id){
		String url = equipmentServiceImpl.getEquipmentJsjkById(equipment_id);
		return new NutMap("data",url);
	}
	
	//查询设备bim模型
	@At("/findEquipmentBimodel/?")
	@Ok("json:full")
	public NutMap findEquipmentBimodel(String equipment_id){
		String url = equipmentServiceImpl.getEquipmentBimodel(equipment_id);
		return new NutMap("data",url);
	}

	
}
